@extends('home.parent')
@section('title','修改合伙人')
@section('head_js')
@endsection
@section('head_css')
<link rel="stylesheet" href="{{ asset('/css/select2/select2.min.css') }}">
<link rel="stylesheet" href="{{ asset('/css/datepicker3.css') }}">
@endsection
@section('content')
<div class="content-wrapper">
<section class="content-header">
    <h1>修改合伙人<small></small></h1>
    <ol class="breadcrumb">
        <li><a href="{{URL('admin')}}"><i class="fa fa-dashboard"></i>首页</a></li>
        <li><a href="{{URL('admin/partner/list')}}">合伙人列表</a></li>
        <li class="active">修改合伙人</li>
    </ol>
</section>
<style>
	form div input[type="password"],form div input[type="text"],select[name="industry_id"],select[name="gender"],select[name="pay_type"]{width:280px;color:#717171;}
	form div label{padding: 7px 15px 0 0;text-align:right;color:#717171;}
	form div button{margin-right:10px;}
	form div.ca_number{display:none;}
	
	form div.box-body label{width:100px;}
	form div input.form-control,form div select.form-control{display:inline;}
	#data_form span.fa{top:10px;left:390px;margin-left:-18px;position:absolute;cursor:pointer;color:#009688;}
	@media screen and (max-width: 465px) {
		#data_form span.fa{top:41px;left:290px;margin-left:-18px;position:absolute;cursor:pointer;color:#009688;}
	}
</style>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <!--general form elements-->
            <div class="box box-primary">
                <form id="data_form">
                    <div class="box-body">
                        <div class="form-group col-lg-6 col-md-12">
                            <label class="control-label"> 登录用户名</label>
                            <input type="text" class="form-control" value="{{ $data['user_name'] }}" readonly>
                        </div>
                        <div class="form-group col-lg-6 col-md-12">
							<span class="fa fa-eye showPwd"></span>
                            <label class="control-label">登录密码</label>
                            <input type="password" class="form-control" name="pwd" placeholder="不填则默认不修改（6-16位 字母、数字、下划线）" value="" maxlength="16">
                        </div>
                        <div class="form-group col-lg-6 col-md-12">
                            <label class="control-label">所在地
                                <span style="color: red">*</span>
                            </label>
                            <input type="text" class="form-control" name="city" placeholder="请输入所在地" value="{{ $data['city'] }}" maxlength="20">
                        </div>
                        <div class="form-group col-lg-6 col-md-12">
                            <label class="control-label">机构
                                <span style="color: red">*</span>
                            </label>
                            <input type="text" class="form-control" name="company" placeholder="请输入合伙人机构" value="{{ $data['company'] }}" maxlength="20">
                        </div>
                        <div class="form-group col-lg-6 col-md-12">
                            <label class="control-label">具体地址
                                <span style="color: red">*</span>
                            </label>
                            <input type="text" class="form-control" name="address" placeholder="请输入具体地址" value="{{ $data['address'] }}" maxlength="200">
                        </div>
                        <div class="form-group col-lg-6 col-md-12">
                            <label class="control-label">联系人
                                <span style="color: red">*</span>
                            </label>
                            <input type="text" class="form-control" name="name" placeholder="请输入合伙人联系人" value="{{ $data['name'] }}" maxlength="8">
                        </div>
                        <div class="form-group col-lg-6 col-md-12">
                            <label class="control-label">性别</label>
                            <select class="form-control" name="gender">
                                <option value="0">--请选择--</option>
                                <option value="1" @if($data[ 'gender']==1)selected @endif>男</option>
                                <option value="2" @if($data[ 'gender']==2)selected @endif>女</option>
                            </select>
                        </div>
                        <div class="form-group col-lg-6 col-md-12">
                            <label class="control-label">手机号
                                <span style="color: red">*</span>
                            </label>
                            <input type="text" class="form-control" name="mobile" placeholder="请输入合伙人手机号" value="{{ $data['mobile'] }}" maxlength="11">
                        </div>
                        <div class="form-group col-lg-6 col-md-12">
                            <label class="control-label">微信</label>
                            <input type="text" class="form-control" name="wechat" placeholder="请输入联系人微信号" value="{{ $data['wechat'] }}" maxlength="16">
                        </div>
                        <div class="form-group col-lg-6 col-md-12">
                            <label class="control-label">邮箱</label>
                            <input type="text" class="form-control" name="email" placeholder="请输入联系人邮箱" value="{{ $data['email'] }}" maxlength="100">
                        </div>
                        <div class="form-group col-lg-6 col-md-12">
                            <label class="control-label">倍数
								<span style="color: red">*</span>
							</label>
                            <input type="text" class="form-control" name="discount" placeholder="小于等于100的数值，最多一位小数" value="{{ $data['discount'] }}" maxlength="5">
                        </div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">开户金额
								<span style="color: red">*</span>
							</label>
							<input type="text" class="form-control" name="first_price" placeholder="请输入不以0开头的整数" value="{{ $data['first_price'] }}" maxlength="10">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">支付方式
								<span style="color: red">*</span>
							</label>
							<select class="form-control" name="pay_type">
								<option value="0">--请选择--</option>
								@if(!empty(Config('basics.pay_type')))@foreach(Config('basics.pay_type') as $k => $v)
								<option value="{{ $k }}" @if(isset($orderlist['pay_type'])&&$orderlist['pay_type']==$k)selected @endif>
									{{ $v }}
								</option>
								@endforeach @endif
							</select>
						</div>
						<div class="form-group col-lg-6 col-md-12 ca_number" style="{{ isset($orderlist['pay_type'])&&$orderlist['pay_type']==4?'display:inline-block':'' }}">
							<label class="control-label">对公账户号
								<span style="color: red">*</span>
							</label>
							<input type="text" class="form-control" name="ca_number" placeholder="请输入对公账户号" value="{{ isset($orderlist['ca_number'])?$orderlist['ca_number']:'' }}" maxlength="30">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">备注</label>
							<input type="text" class="form-control" name="remark" value="{{ isset($orderlist['remark']) ? $orderlist['remark'] : '' }}" autocomplete="off" placeholder="备注">
						</div>
                    </div>
                    <!--/.box-body-->
                    <div class="box-footer">
						<label class="col-sm-1 control-label"></label>
						<input type="hidden" name="kid" value="{{ $data['id'] }}">
						<button type="button" class="btn btn-info data_form">提 交</button>
						<button type="reset" class="btn btn-default">重 置</button>
						<button type="button" class="btn btn-default" onclick="history.go(-1)">取 消</button>
					</div>
                </form>
            </div>
        </div>
    </div>
</section>
</div>
@endsection
@section('foot_js')
<script src="{{ asset('/js/apk.js') }}"></script>
<script src="{{ asset('/js/tools.js') }}"></script>
<script src="{{ asset('/js/bootstrap-datepicker.js') }}"></script>
<script>
$(document).ready(function(){
	$('input[name="start_date"]').datepicker({
		startDate: "{{date('Y-m-d',time())}}",
		todayHighlight: true,
		language: "zh-CN",
		autoclose: true,//选中之后自动隐藏日期选择框
		format: "yyyy-mm-dd"//日期格式，详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
	});
	$('input[name="end_date"]').datepicker({
		startDate: "{{date('Y-m-d',time())}}",
		todayHighlight: true,
		language: "zh-CN",
		autoclose: true,//选中之后自动隐藏日期选择框
		format: "yyyy-mm-dd"//日期格式，详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
	});
})
$('select[name="pay_type"]').change(function(){
	if($(this).val()==4){
		$('#data_form div.ca_number').show();
	}else{
		$('#data_form div.ca_number').hide();
	}
});
$('#data_form button.data_form').click(function(){
	var data=$('#data_form').serialize();
	var url = "{{URL('admin/partner/edit/save')}}";
	var result = puppet.myajax('post',url,data,false);
	if(result.code == 1){
        layer.msg('修改失败',{icon:2});
		return false;
	}else{
        layer.msg('修改成功',{icon:1});
		setInterval(function(){
			window.location.href=result.url;
		},"2000");
	}
})
//查看密码
$('.showPwd').hover(function(){
	$(this).removeClass('fa-eye');
	$(this).addClass('fa-eye-slash');
	$(this).parent().children('input').attr('type','text');
},function(){
	$(this).removeClass('fa-eye-slash');
	$(this).addClass('fa-eye');
	$(this).parent().children('input').attr('type','password');
});
</script>
@endsection